﻿@{
    ViewBag.Title = "首页";
}
<div class="jumbotron">
    <p>
        <h1>学无先后达者为师</h1>
    </p>
</div>
<div class="benefits container">
    @{
        var cats = Category.Root.Childs.ToList().Where(e => e.Model == null || e.Model.Enable).ToList();
        var cell = 3;
        var width = 12 / cell;
        var left = 12 - width * cell;
        var right = left / 2;
        left -= right;
        for (int i = 0; i < cats.Count; )
        {
            <div class="row">
                @if (left > 0)
                {
                    <div class="col-md-@left"></div>
                }
                @for (int j = 0; j < cell && i < cats.Count; j++, i++)
                {
                    var cat = cats[i];
                    <div class="col-md-@width">
                        <div class="col-md-8">
                            <h2>@cat.Name</h2>
                        </div>
                        <div class="col-md-4" style="vertical-align:text-bottom">
                            <a href="@this.GetCategoryUrl(cat)">更多</a>
                        </div>
                        <div class="col-md-12 widget_list lz_con fixed tab_list show">
                            <ul>
                                @foreach (var item in cat.GetInfos(1, 5))
                                {
                                    <li>
                                        [<a href="@this.GetCategoryUrl(item.Category)" target="_blank">
                                            <i></i>@item.CategoryName
                                        </a>]
                                        <a href="@this.GetUrl(item)" target="_blank">
                                            <i></i>@item.Title
                                        </a>
                                    </li>
                                }
                            </ul>
                        </div>
                    </div>
                }
                @if (right > 0)
                {
                    <div class="col-md-@right"></div>
                }
            </div>
        }
    }
</div>
